//
//  PopPresentController.m
//  TEST
//
//  Created by beisheng03 on 2017/9/25.
//  Copyright © 2017年 beisheng. All rights reserved.
//

#import "PopPresentController.h"

@interface PopPresentController()

@property (nonatomic, strong) UIButton *btn;

@end

@implementation PopPresentController

- (UIButton *)btn{

    if (_btn == nil) {
        _btn = [UIButton buttonWithType:UIButtonTypeCustom];
        _btn.backgroundColor = [UIColor colorWithWhite:0.2 alpha:0.3];
        [_btn addTarget:self action:@selector(bgBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
    }


    return  _btn;
}

- (void)containerViewWillLayoutSubviews{
    
    [super containerViewWillLayoutSubviews];
    
    self.containerView.backgroundColor = [UIColor clearColor];
    
    self.presentedView.frame = CGRectMake(0, KScreenH * 0.4, [UIScreen mainScreen].bounds.size.width, KScreenH * 0.6);
    
}


- (void)presentationTransitionWillBegin{
    
    [super presentationTransitionWillBegin];
    [self.containerView addSubview:self.btn];
    self.btn.frame = self.containerView.bounds;

}


- (void)bgBtnDidClick{

    [self.presentedViewController dismissViewControllerAnimated:YES completion:nil];

}
@end
